<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/img/logo.png">
    <!-- Place this tag in your head or just before your close body tag. -->
    <script async defer src="https://buttons.github.io/buttons.js"></script>
    <title>
        
          批量给图片添加水印 - 宋正兵的博客 | zbsong Blog
        
    </title>

    <link rel="canonical" href="zbsong.top/article/批量给图片添加水印/">

    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <!-- Custom CSS --> 
    <link rel="stylesheet" href="/css/beantech.min.css">

    <link rel="stylesheet" href="/css/donate.css">
    
    <!-- Pygments Highlight CSS -->
    <link rel="stylesheet" href="/css/highlight.css">

    <link rel="stylesheet" href="/css/widget.css">

    <link rel="stylesheet" href="/css/rocket.css">

    <link rel="stylesheet" href="/css/signature.css">

    <link rel="stylesheet" href="/css/toc.css">

    <!-- Custom Fonts -->
    <!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
    <!-- Hux change font-awesome CDN to qiniu -->
    <link href="https://cdn.staticfile.org/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


    <!-- Hux Delete, sad but pending in China
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/
    css'>
    -->


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- ga & ba script hoook -->
    <script></script>
</head>


<!-- hack iOS CSS :active style -->
<body ontouchstart="">
	<!-- Modified by Yu-Hsuan Yen -->
<!-- Post Header -->
<style type="text/css">
    header.intro-header{
        
            background-image: url('https://api.dujin.org/bing/1920.php')
            /*post*/
        
    }
    
</style>

<header class="intro-header" >
    <!-- Signature -->
    <div id="signature">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                
                    <div class="post-heading">
                        <div class="tags">
                            
                              <a class="tag" href="/tags/#java项目" title="java项目">java项目</a>
                            
                        </div>
                        <h1>批量给图片添加水印</h1>
                        <!-- <h2 class="subheading">兴趣使然去实现</h2> -->
                        <span class="meta">
                            宋正兵 on
                            2020-09-28
                        </span>
                    </div>
                


                </div>
            </div>
        </div>
    </div>
</header>

    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">songzblink</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <!-- Known Issue, found by Hux:
            <nav>'s height woule be hold on by its content.
            so, when navbar scale out, the <nav> will cover tags.
            also mask any touch event of tags, unfortunately.
        -->
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/">主页</a>
                    </li>
					<li>
                        <a href="/archive/">归档</a>
                    </li>
					<li>
                        <a href="/tags/">标签</a>
                    </li>
					<li>
                        <a href="/about/">关于</a>
                    </li>
					<!--
					修改about在前面的问题
                    
                        
                    
                        
                        <li>
                            <a href="/about/">关于</a>
                        </li>
                        
                    
                        
                        <li>
                            <a href="/archive/">归档</a>
                        </li>
                        
                    
                        
                        <li>
                            <a href="/tags/">标签</a>
                        </li>
                        
                    
                    -->
                </ul>
            </div>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<script>
    // Drop Bootstarp low-performance Navbar
    // Use customize navbar with high-quality material design animation
    // in high-perf jank-free CSS3 implementation
    var $body   = document.body;
	// querySelector 获取文档中 id="demo" 的元素
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        // CLOSE
            $navbar.className = " ";
            // wait until animation end.
            setTimeout(function(){
                // prevent frequently toggle
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        // OPEN
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>


    <!-- Main Content -->
    <!-- Modify by Yu-Hsuan Yen -->

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

            <!-- Post Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

				
                <h1 id="java-如何给图片添加水印">Java 如何给图片添加水印</h1>
<p><a href="https://github.com/songzblink/Auto-Watermark" target="_blank" rel="noopener">需要源码点这里</a></p>
<p>想要在 java 程序中绘图，一定绕不开 <code>Graphics</code> 类，这里用它的子类 <code>Graphics2D</code> 类，java 绘图的基本操作流程如下：</p>
<ul>
<li>使用 <code>ImageIO</code> 类的 <code>read()</code> 方法将需要被添加水印的图片加载；</li>
<li>创建一个 <code>BufferedImage</code> 实例 ，在其构造函数里指定长，宽，高，类型为 <code>BufferedImage.TYPE_INT_RGB</code> ，即创建一个指定分辨率的空图片 <code>bimage</code>；</li>
<li>调用 <code>BufferedImage</code> 对象的 <code>createGraphics()</code> 方法，得到 <code>Graphics2D</code> 实例；</li>
<li>使用 <code>Graphics2D</code> 实例进行绘图，所以绘图操作的坐标基于创建此 <code>Graphics2D</code> 实例的 <code>BufferedImage</code> 实例。示例中在图片上画了一串字符串；</li>
<li>调用 <code>Graphics2D</code> 对象的 <code>dispose()</code> 方法，进行绘图处理，使绘图效果应用到 <code>BufferedImage</code> 对象；</li>
<li>使用 <code>ImageIO</code> 类的 <code>write()</code> 方法将 <code>BufferedImage</code> 对象转换到文件或二进制流。</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 加载图片</span></span><br><span class="line">Image image = ImageIO.read(<span class="keyword">new</span> File(<span class="string">"images/test.png"</span>));</span><br><span class="line"><span class="keyword">int</span> width = <span class="number">200</span>, height = <span class="number">250</span>;</span><br><span class="line"><span class="comment">// 创建图片对象</span></span><br><span class="line">BufferedImage bimage = <span class="keyword">new</span> BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);</span><br><span class="line"><span class="comment">// 基于图片对象打开绘图</span></span><br><span class="line">Graphics2D graphics = image.createGraphics();</span><br><span class="line"></span><br><span class="line"><span class="comment">// 绘图逻辑 START （基于业务逻辑进行绘图处理）……</span></span><br><span class="line"><span class="comment">// 绘制一串字符串</span></span><br><span class="line">Font font = <span class="keyword">new</span> Font(<span class="string">"宋体"</span>,Font.BOLD, <span class="number">10</span>);</span><br><span class="line">g.setFont(font);</span><br><span class="line">g.setColor(Color.RED);</span><br><span class="line"><span class="comment">// 绘制当前可用的指定图像。在该图形上下文的坐标空间中，图像的左上角位于（x，y）。</span></span><br><span class="line">g.drawImage(image, <span class="number">0</span>, <span class="number">0</span>, <span class="keyword">null</span>);</span><br><span class="line">g.drawString(<span class="string">"水印测试"</span>, <span class="number">0</span>, font.getSize());</span><br><span class="line"><span class="comment">// 绘图逻辑 END</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 处理绘图，输出</span></span><br><span class="line">graphics.dispose();</span><br><span class="line"><span class="comment">// 将绘制好的图片写入到图片</span></span><br><span class="line"><span class="comment">// ImageIO.write(image, "png", new File("abc.png"));</span></span><br><span class="line"><span class="comment">// 得到图片的格式后缀</span></span><br><span class="line">String formatName = file.getName().split(<span class="string">"\\."</span>)[<span class="number">1</span>];</span><br><span class="line">ImageIO.write(bimage, formatName, <span class="keyword">new</span> File(<span class="string">"abc.png"</span>));</span><br></pre></td></tr></table></figure>
<h1 id="批量给图片添加水印">批量给图片添加水印</h1>
<p>如果想要批量的给图片添加水印，想到的办法是将待处理图片都存放到同一目录下，这里指定为 <code>images/</code> ，通过调用 <code>File</code> 对象的 <code>listFiles()</code> 方法获得目录下所有文件的相对路径（注意它包括目录下的子目录，所以需要判断当前操作对象是不是文件），再对每个 <code>File</code> 对象进行绘图处理。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 加载目录路径</span></span><br><span class="line">String path = <span class="string">"images/"</span>;</span><br><span class="line">File[] files = <span class="keyword">new</span> File(path).listFiles();</span><br><span class="line"><span class="keyword">for</span> (File file : files) &#123;</span><br><span class="line">    <span class="keyword">if</span> (!file.isDirectory()) &#123;</span><br><span class="line">        <span class="comment">// 添加水印操作</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="利用配置文件添加水印">利用配置文件添加水印</h1>
<p>java 读取配置文件的方法有<a href="https://www.cnblogs.com/sebastian-tyd/p/7895182.html" target="_blank" rel="noopener">好几种</a>，这里选择的是通过读取 <code>.preperties</code> 文件来进行配置。</p>
<p>观察上面的代码，我们能抽取出来部分配置信息并写入 <code>watermark.properties</code> 文件中，让 java 程序自动读取，而使用者只需要进行这部分信息的配置，并且把待添加水印的图片存放到指定路径即可。 <code>watermark.properties</code> 文件如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"># 待添加水印图片的路径</span><br><span class="line">basePath=images/</span><br><span class="line"># 文字水印的内容</span><br><span class="line">context=测试水印</span><br><span class="line"># 文字水印的字体</span><br><span class="line">fontName=宋体</span><br><span class="line"># 文字水印字体的样式</span><br><span class="line"># PLAIN 1  BOLD 2   ITALIC 3 </span><br><span class="line">fontStyle=1</span><br><span class="line"># 文字水印字体的大小</span><br><span class="line">fontsize=20</span><br><span class="line"># 文字水印字体的颜色</span><br><span class="line">color=white</span><br><span class="line"># 文字水印字体的位置，上中下，每层左中右三个点位</span><br><span class="line"># 1~9</span><br><span class="line">location=8</span><br></pre></td></tr></table></figure>
<p>创建输入缓冲流 <code>InputStream</code> 类， <code>filePath</code> 是配置文件 <code>watermark.properties</code> 的相对路径。然后利用 <code>properties</code> 类来读取配置文件中的属性，利用方法 <code>getProperty(String key)</code> 可以得到文件内的属性配置。</p>
<blockquote>
<p>这里我并没有理解通过输入缓冲流进行读取配置文件为啥这么写，如果有知道的同学欢迎发邮件指教</p>
</blockquote>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 通过输入缓冲流进行读取配置文件</span></span><br><span class="line">InputStream InputStream = <span class="keyword">new</span> BufferedInputStream(<span class="keyword">new</span> FileInputStream(<span class="keyword">new</span> File(filePath)));</span><br><span class="line"><span class="comment">// 加载配置</span></span><br><span class="line">Properties p = <span class="keyword">new</span> Properties();</span><br><span class="line"><span class="keyword">try</span> &#123;</span><br><span class="line">    p.load(bf);</span><br><span class="line">&#125; <span class="keyword">catch</span> (IOException e1) &#123;</span><br><span class="line">    e1.printStackTrace();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

                
                <hr>
                <!-- Pager -->
                <ul class="pager">
                    
                        <li class="previous">
                            <a href="/article/tk-mybatis—集成通用mapper/" data-toggle="tooltip" data-placement="top" title="tk.mybatis的使用">&larr; 上一篇</a>
                        </li>
                    
                    
                        <li class="next">
                            <a href="/article/ruyun/" data-toggle="tooltip" data-placement="top" title="如云，那就做如云">下一篇 &rarr;</a>
                        </li>
                    
                </ul>

                <br>

                <!--打赏-->
                
                <!--打赏-->

                <br>
                <!--分享-->
                
                <!--分享-->
                <br>                       
                
                <!-- require APlayer -->
                
            </div>
            
            <!-- Tabe of Content -->
            <!-- Table of Contents -->

  
    <style>
      span.toc-nav-number{
        display: none
      }
    </style>
  
    
      <aside id="sidebar">
        <div id="toc" class="toc-article">
        <strong class="toc-title">目录</strong>
        
          <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#java-如何给图片添加水印"><span class="toc-nav-number">1.</span> <span class="toc-nav-text">Java &#x5982;&#x4F55;&#x7ED9;&#x56FE;&#x7247;&#x6DFB;&#x52A0;&#x6C34;&#x5370;</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#批量给图片添加水印"><span class="toc-nav-number">2.</span> <span class="toc-nav-text">&#x6279;&#x91CF;&#x7ED9;&#x56FE;&#x7247;&#x6DFB;&#x52A0;&#x6C34;&#x5370;</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#利用配置文件添加水印"><span class="toc-nav-number">3.</span> <span class="toc-nav-text">&#x5229;&#x7528;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x6DFB;&#x52A0;&#x6C34;&#x5370;</span></a></li></ol>
        
        </div>
      </aside>
    

                
            <!-- Sidebar Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                <!-- Featured Tags -->
                
                <section>
                    <!-- no hr -->
                    <h5><a href="/tags/">标签</a></h5>
                    <div class="tags">
                       
                          <a class="tag" href="/tags/#java项目" title="java项目">java项目</a>
                        
                    </div>
                </section>
                

                <!-- Friends Blog -->
				<!--
                
                <hr>
                <h5>朋友们</h5>
                <ul class="list-inline">

                    
                        <li><a href="https://tyzhang.top/" target="_blank">ztygalaxy</a></li>
                    
                        <li><a href="http://www.yctang.club/" target="_blank">yctang</a></li>
                    
                        <li><a href="https://dolnw.github.io" target="_blank">JCWang</a></li>
                    
                </ul>
                
				-->
            </div>
        </div>
    </div>
</article>


<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>
<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ -->
<script>
    async("https://cdn.bootcss.com/anchor-js/1.1.1/anchor.min.js",function(){
        anchors.options = {
          visible: 'hover',
          placement: 'left',
          icon: ''
        };
        anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');
    })
</script>
<style>
    /* place left on bigger screen */
    @media all and (min-width: 800px) {
        .anchorjs-link{
            position: absolute;
            left: -0.75em;
            font-size: 1.1em;
            margin-top : -0.1em;
        }
    }
</style>


<!-- chrome Firefox 中文锚点定位失效-->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<!-- smooth scroll behavior polyfill  -->
<script type="text/javascript" src="/js/smoothscroll.js"></script>
<script>
        $('#toc').on('click','a',function(a){
            // var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
            // console.log(window.navigator.userAgent,isChrome)
                // if(isChrome) {
                    // console.log(a.currentTarget.outerHTML);
                    // console.log($(a.currentTarget).attr("href"));
                    //跳转到指定锚点
                    // document.getElementById(a.target.innerText.toLowerCase()).scrollIntoView(true);
                    document.getElementById($(a.currentTarget).attr("href").replace("#","")).scrollIntoView({behavior: 'smooth' });
                // }
        })  
</script>


    <!-- Footer -->
    <!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                
                
                
				
                

                

                
                    <li>
                        <a target="_blank"  href="https://github.com/songzblink">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                

                </ul>
                <p class="copyright text-muted">
                    Copyright &copy; 宋正兵 2021 
                    <br>
                    Theme by <a href="http://www.huweihuang.com">Huwei Huang</a>
                    re-Ported by <a href="https://github.com/ztygalaxy">ztygalaxy</a>
					
                </p>
            </div>
        </div>
    </div>
</footer>

<!-- jQuery -->
<script src="/js/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="/js/bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="/js/hux-blog.min.js"></script>


<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>

<!-- 
     Because of the native support for backtick-style fenced code blocks 
     right within the Markdown is landed in Github Pages, 
     From V1.6, There is no need for Highlight.js, 
     so Huxblog drops it officially.

     - https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0  
     - https://help.github.com/articles/creating-and-highlighting-code-blocks/    
-->
<!--
    <script>
        async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){
            hljs.initHighlightingOnLoad();
        })
    </script>
    <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
-->


<!-- jquery.tagcloud.js -->
<script>
    // only load tagcloud.js in tag.html
    if($('#tag_cloud').length !== 0){
        async("zbsong.top/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>

<!--fastClick.js -->
<script>
    async("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->




<!-- Baidu Tongji -->






	<a id="rocket" href="#top" class=""></a>
	<script type="text/javascript" src="/js/totop.js?v=1.0.0" async=""></script>
    <script type="text/javascript" src="/js/toc.js?v=1.0.0" async=""></script>
<!-- Image to hack wechat -->
<img src="zbsong.top/img/icon_wechat.png" width="0" height="0" />
<!-- Migrate from head to bottom, no longer block render and still work -->

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ["$","$"], ["\\(","\\)"] ],
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
            processEscapes: true
        }
    });
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax();
        for (var i = 0; i < all.length; ++i)
            all[i].SourceElement().parentNode.className += ' has-jax';
    });
</script>
<!--
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"></script>
</body>

</html>
